from django.urls import path
from . import views

urlpatterns = [
    # 用户界面
    path('', views.UserBookListView.as_view(), name='user_book_list'),
    path('borrow/<int:book_id>/', views.borrow_book, name='borrow_book'),
    path('mybooks/', views.MyBooksListView.as_view(), name='my_books'),
    path('return/<int:record_id>/', views.return_book, name='return_book'),
    path('renew/<int:record_id>/', views.renew_loan, name='renew_loan'),
    path('profile/', views.user_profile, name='user_profile'),

    # 图书详情
    path('book/<int:pk>/', views.BookDetailView.as_view(), name='book_detail'),
    path('book/<int:pk>/generate-summary/', views.generate_summary_view, name='generate_summary'),

    # 管理员界面
    path('manage/', views.DashboardView.as_view(), name='dashboard'),
    path('manage/books/', views.ManageBookListView.as_view(), name='manage_book_list'),
    path('manage/books/add/', views.BookCreateView.as_view(), name='add_book'),
    path('manage/books/<int:pk>/edit/', views.BookUpdateView.as_view(), name='edit_book'),
    path('manage/books/<int:pk>/delete/', views.BookDeleteView.as_view(), name='delete_book'),
    path('manage/borrowed/', views.BorrowedBooksListView.as_view(), name='borrowed_list'),
    path('manage/statistics/', views.statistics_view, name='statistics'),

    # 作者管理
    path('manage/authors/', views.AuthorListView.as_view(), name='author_list'),
    path('manage/authors/add/', views.AuthorCreateView.as_view(), name='add_author'),
    path('manage/authors/<int:pk>/edit/', views.AuthorUpdateView.as_view(), name='edit_author'),
    path('manage/authors/<int:pk>/delete/', views.AuthorDeleteView.as_view(), name='delete_author'),

    # 分类管理
    path('manage/categories/', views.CategoryListView.as_view(), name='category_list'),
    path('manage/categories/add/', views.CategoryCreateView.as_view(), name='add_category'),
    path('manage/categories/<int:pk>/edit/', views.CategoryUpdateView.as_view(), name='edit_category'),
    path('manage/categories/<int:pk>/delete/', views.CategoryDeleteView.as_view(), name='delete_category'),

    # 出版社管理
    path('manage/publishers/', views.PublisherListView.as_view(), name='publisher_list'),
    path('manage/publishers/add/', views.PublisherCreateView.as_view(), name='add_publisher'),
    path('manage/publishers/<int:pk>/edit/', views.PublisherUpdateView.as_view(), name='edit_publisher'),
    path('manage/publishers/<int:pk>/delete/', views.PublisherDeleteView.as_view(), name='delete_publisher'),
]